package com.yutel.http.HttpServer;

import java.net.InetSocketAddress;

import com.sun.net.httpserver.HttpServer;
import com.yutel.http.HttpServer.handler.PlayHandler;
import com.yutel.http.HttpServer.handler.ServerInfoHandler;

public class TestHttpServer {

	public static void main(String[] args) {
		try {
			// 实现HTTP SERVER
			HttpServer hs = HttpServer.create(new InetSocketAddress(8888), 0);// 设置HttpServer的端口为80
			hs.createContext("/server-info", new ServerInfoHandler());// 用MyHandler类内处理到/的请求
			hs.createContext("/play", new PlayHandler());// 用MyHandler类内处理到/的请求
			hs.setExecutor(null); // creates a default executor
			hs.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
